import gc
import os
import esp
import machine
import network
from machine import Pin
esp.osdebug(None)
gc.collect()
machine.freq(160000000)

wifi_ssid = "JOE"
wifi_key = "12345678"

SERVER = "bemfa.com"
CLIENT_ID = "260e3a3a6fexxxxxxx92802cd87310349d"
TOPIC = b"test006"
PORT = 9501

LED = Pin(2,Pin.OUT)

def do_connect(ssid,key):
    import network
    wlan = network.WLAN(network.STA_IF)
    wlan.active(True)
    if not wlan.isconnected():
        print('connecting to network...')
        wlan.connect(ssid, key)
        while not wlan.isconnected():
            pass
    print('network config:', wlan.ifconfig())

do_connect(wifi_ssid,wifi_key)
print('Connection successful')



          
